package com.xinyue.auto.reader.util;

import com.xinyue.auto.type.Type;

public class SetterUtil implements Type{
	
	public static String setterHQL(String name, String type) {
		String setter = null;
		
		if(DATE.equals(type)) {
			setter = "q.setDate(\"" + name + "\", " + name + ");";
		}else if(BIGDECIMAL.equals(type)) {
			setter = "q.setBigDecimal(\"" + name + "\", " + name + ");";
		}else if(STRING.equals(type)) {
			setter = "q.setString(\"" + name + "\", " + name + ");";
		}else if(BOOLEAN.equals(type)) {
			setter = "q.setBoolean(\"" + name + "\", " + name + ");";
		}else if(INT.equals(type)) {
			setter = "q.setInteger(\"" + name + "\", " + name + ");";
		}else if(DOUBLE.equals(type)) {
			setter = "q.setDouble(\"" + name + "\", " + name + ");";
		}else if(LONG.equals(type)) {
			setter = "q.setLong(\"" + name + "\", " + name + ");";
		}else if(FLOAT.equals(type)) {
			setter = "q.setFloat(\"" + name + "\", " + name + ");";
		}else if(BYTE.equals(type)) {
			setter = "q.setByte(\"" + name + "\", " + name + ");";
		}else if(SHORT.equals(type)) {
			setter = "q.setShort(\"" + name + "\", " + name + ");";
		}else if(CHAR.equals(type)) {
			setter = "q.setCharacter(\"" + name + "\", " + name + ");";
		}
		
		return setter;
	}
}
